#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-09-08 8:58 上午
# @Author  : yangdy
# @File    : 2020-09-08.77.组合
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def combine(self, n: int, k: int) -> List[List[int]]:
        ans = []

        def dfs(x, nn, cc):
            if len(cc) >= k:
                ans.append(cc)
                return
            for i in range(x, nn):
                dfs(i + 1, nn, cc + [i])

        dfs(1, n + 1, [])
        return ans
